#include "stdafx.h"
#include "DataPoint.h"
#include <string>
#include <sstream>

using namespace std;


DataPoint::DataPoint(vmml::vec3d* flow,vmml::matrix<3,3,double>* dflow,double ftle){

	this->ftle = ftle;
	this->flow = flow;
	this->dflow = dflow;
	this->empty = false;
	//this->ridge = false;
}

DataPoint::DataPoint(void){
	this->empty = true;
	//this->ridge = false;

	vmml::matrix< 3, 3, double > dflowzero( vmml::matrix< 3, 3, double >::ZERO );
	double flowzero[] = { 0,0,0 };
	vmml::vec3d flowzerovec= flowzero;

	this->ftle = 0;
	this->flow = &flowzerovec;
	this->dflow = &dflowzero;

}

string DataPoint::toString(){
	std::ostringstream strs;

	strs << this->getFTLE();
	string f = strs.str();

	string s = strs.str();

	//return "FTLE: " + f + " SubDivLvl: " + s;
	return f;
}

bool DataPoint::isEmpty(){
	return this->empty;
}

//bool DataPoint::isRidge(){
//	return this->ridge;
//}

vmml::vec3d* DataPoint::getFlow(){
	return this->flow;
}

vmml::matrix<3,3,double>* DataPoint::getDFlow(){
	return this->dflow;
}

double DataPoint::getFTLE(){
	return this->ftle;
}

//void DataPoint::setRidge(bool r){
//	this->ridge = r;
//}

void DataPoint::setGradient(const VectorXd& g){
	this->gradient = g;
}

VectorXd DataPoint::getGradient(){
	return this->gradient;
}

void DataPoint::setEigen(VectorXd e){
	this->eigen = e;
}

VectorXd DataPoint::getEigen(){
	return this->eigen;
}

void DataPoint::setHessian(const MatrixXd& h){
	this->hessian = h;
} 

MatrixXd DataPoint::getHessian(){
	return this->hessian;
}

void DataPoint::setSigma(double s){
	this->sigma = s;
}

double DataPoint::getSigma(){
	return this->sigma;
}

DataPoint::~DataPoint(void){
	delete flow;
	delete dflow;

}
